#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
const int N = 65;
int main()
{
    long long a = 1, b = 1, c = 2, t = 0;
    int n;
    cin >> n;
    for (int i = 3; i <= n; i++)
    {
        t = a + b + c;
        a = b;
        b = c;
        c = t;
    }
    if (n == 1)
    {
        cout << b << endl;
    }
    else
    {
        cout << c << endl;
    }
    return 0;
}